﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.Security;

namespace WordSmith_V1.Library.Security
{
    public class CustomIdentity //: System.Web.Security.FormsIdentity//System.Web.Security.FormsIdentity ,System.Security.Principal.IIdentity
    {
        private  FormsAuthenticationTicket _ticket;
        private readonly string _name;
        private readonly string _role; //user type

      //  public CustomIdentity(
       public CustomIdentity(FormsAuthenticationTicket ticket)
        {
            _ticket = ticket;
        }

        public CustomIdentity(string name,string role)
        {
            _name = name; _role = role;
        }

        public string Name
        {
            get { return _name; }
        }

        public string Role //User type
        {
            get { return _role; }
        }

        public string AuthenticationType
        {
            get { return "WordSmithUser"; }
        }
        public bool IsAuthenticated
        {
            get { return !string.IsNullOrEmpty(Name); }
        }

        public FormsAuthenticationTicket Ticket
        {
            get { return _ticket; }
        }

        

    }
}
